{extend name="public/base" /}
{block name="container"}
<div class="panel panel-default">
  <div class="panel-heading">
    <h4 class="panel-title">修改密码</h4>
  </div>
  <div class="panel-body panel-body-nopadding">

    <form class="form-horizontal form-bordered" id="submitForm" action="" method="post" >
      <div class="form-group">
        <label class="col-sm-3 control-label"><span>*</span>手机号：</label>
        <div class="col-sm-6">
          <input type="text" class="form-control" placeholder="手机号" name="phone" value=""  required>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 control-label"><span>*</span>身份证号码：</label>
        <div class="col-sm-6">
          <input type="text" class="form-control" placeholder="身份证号码" name="id_number" value="" required>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 control-label">卡号:</label>
        <div class="col-sm-6">
          <input type="text" class="form-control" name="card_num" placeholder="请输入卡号"  value=""  >
        </div>
      </div>
      <div class="form-group" id="password" style="display: none">
        <label class="col-sm-3 control-label">密码:</label>
        <div class="col-sm-6">
          <input type="password" class="form-control" name="password" placeholder="请输入密码"  value="" >
        </div>
      </div>
      <div class="form-group" style="display: none" id="repassword">
        <label class="col-sm-3 control-label">确认密码:</label>
        <div class="col-sm-6">
          <input type="password" class="form-control" name="md5_pas" placeholder="请输入确认密码">
        </div>
      </div>
      <div class="panel-footer">
       <div class="row">
        <div class="col-sm-6 col-sm-offset-3">
          <input type="hidden" name="id" value="{$data.id ?? ''}">
          <button type="submit" class="btn btn-primary">提交</button>
          <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);">返回</button>
        </div>
      </div>
    </div><!-- panel-footer -->

  </form>
</div>
{/block}
{block name="js"}
<script>
  $(function() {
    /*给卡号绑定回车事件 先查询下有没有该卡信息*/
    $("[name='card_num']").bind('keydown',  function(event) {
      if (event.keyCode == "13") {
        var card_num  = $("[name='card_num']").val();
        var phone     = $("[name='phone']").val();
        var id_number = $("[name='id_number']").val();
        $.post('{:url("index/member/checkInfo")}', {card_num: card_num,phone:phone,id_number:id_number}, function(data) {
          console.log(data);
            if(data.sta == 1)
            {
              $('#password').css('display','block');
              $('#repassword').css('display','block');
              // return false;
            }else{
              swal({
                        title: "信息不匹配",      
                        text: "",
                        type: "error"
                    }); 
              // return false;
            }
        });
        return false;
      }
    });
  });
  function checkInfo()
  {

  }
</script>
{/block}